<!DOCTYPE html>
<html lang="en">
<head>
    
    <meta charset="utf-8">
    <title>JIFFClient - JIFF Library Documentation</title>
    
    
    
    
    
    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
    <script src="scripts/nav.js" defer></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
  <div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav >
    
    <input type="text" id="nav-search" placeholder="Search" />
    
    <h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/multiparty/jiff" target="_blank" class="menu-item" id="github_link" >Github Repo</a></h2><h2><a href="./intro.html" target="_self" class="menu-item" id="github_link" >Tutorial</a></h2><h2><a href="./contributing.html" target="_self" class="menu-item" id="github_link" >Contributing to JIFF</a></h2><h3>Classes</h3><ul><li><a href="GuardedSocket.html">GuardedSocket</a><ul class='methods'><li data-type='method'><a href="GuardedSocket.html#disconnect">disconnect</a></li><li data-type='method'><a href="GuardedSocket.html#is_empty">is_empty</a></li><li data-type='method'><a href="GuardedSocket.html#resend_mailbox">resend_mailbox</a></li><li data-type='method'><a href="GuardedSocket.html#safe_disconnect">safe_disconnect</a></li><li data-type='method'><a href="GuardedSocket.html#safe_emit">safe_emit</a></li></ul></li><li><a href="helpers.Deferred.html">Deferred</a><ul class='methods'><li data-type='method'><a href="helpers.Deferred.html#reject">reject</a></li><li data-type='method'><a href="helpers.Deferred.html#resolve">resolve</a></li></ul></li><li><a href="module-jiff-client-JIFFClient.html">JIFFClient</a><ul class='methods'><li data-type='method'><a href="module-jiff-client-JIFFClient.html#add_to_barriers">add_to_barriers</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#apply_extension">apply_extension</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#can_apply_extension">can_apply_extension</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#connect">connect</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#disconnect">disconnect</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#emit">emit</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#end_barrier">end_barrier</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#executePreprocessing">executePreprocessing</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#extension_applied">extension_applied</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#free">free</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#from_crypto_provider">from_crypto_provider</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#gen_op_id">gen_op_id</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#gen_op_id2">gen_op_id2</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#gen_op_id2_preprocessing">gen_op_id2_preprocessing</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#gen_op_id_preprocessing">gen_op_id_preprocessing</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#get_preprocessing">get_preprocessing</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#has_extension">has_extension</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#has_preprocessing">has_preprocessing</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#internal_open">internal_open</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#internal_share">internal_share</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#isInitialized">isInitialized</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#isReady">isReady</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#listen">listen</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#open">open</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#open_array">open_array</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#preprocessing">preprocessing</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#preprocessingDaemon">preprocessingDaemon</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#receive_open">receive_open</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#remove_listener">remove_listener</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#reshare">reshare</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#seed_ids">seed_ids</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#share">share</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#share_array">share_array</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#start_barrier">start_barrier</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient.html#store_preprocessing">store_preprocessing</a></li></ul></li><li><a href="module-jiff-client-JIFFClient_SecretShare.html">SecretShare</a><ul class='methods'><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#add">add</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#bit_decomposition">bit_decomposition</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cadd">cadd</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cdiv">cdiv</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cdivfac">cdivfac</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#ceq">ceq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cgt">cgt</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cgteqn">cgteqn</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#clt">clt</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#clteq">clteq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cmult">cmult</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cneq">cneq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cor_bit">cor_bit</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cpow">cpow</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#csub">csub</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#cxor_bit">cxor_bit</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#div">div</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#eq">eq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#error">error</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#gt">gt</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#gteq">gteq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#if_else">if_else</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#isConstant">isConstant</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#logLEAK">logLEAK</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#lt">lt</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#lt_halfprime">lt_halfprime</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#lteq">lteq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#mult">mult</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#neq">neq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#not">not</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#open">open</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#or_bit">or_bit</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#promise_handler">promise_handler</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#refresh">refresh</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sadd">sadd</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sdiv">sdiv</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#seq">seq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sgt">sgt</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sgteq">sgteq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#slt">slt</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#slteq">slteq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#smod">smod</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#smult">smult</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#smult_bgw">smult_bgw</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sneq">sneq</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sor_bit">sor_bit</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#ssub">ssub</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sub">sub</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#sxor_bit">sxor_bit</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#toString">toString</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#valueOf">valueOf</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#when_both_ready">when_both_ready</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#wThen">wThen</a></li><li data-type='method'><a href="module-jiff-client-JIFFClient_SecretShare.html#xor_bit">xor_bit</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-jiff-client.html">jiff-client</a></li></ul><h3>Namespaces</h3><ul><li><a href="bits.html">bits</a><ul class='methods'><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.bit_composition">jiffClient.protocols.bits.bit_composition</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.cadd">jiffClient.protocols.bits.cadd</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.cdivl">jiffClient.protocols.bits.cdivl</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.cdivr">jiffClient.protocols.bits.cdivr</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.ceq">jiffClient.protocols.bits.ceq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.cgt">jiffClient.protocols.bits.cgt</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.cgteq">jiffClient.protocols.bits.cgteq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.clt">jiffClient.protocols.bits.clt</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.clteq">jiffClient.protocols.bits.clteq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.cmult">jiffClient.protocols.bits.cmult</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.cneq">jiffClient.protocols.bits.cneq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.csubl">jiffClient.protocols.bits.csubl</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.csubr">jiffClient.protocols.bits.csubr</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.open">jiffClient.protocols.bits.open</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.rejection_sampling">jiffClient.protocols.bits.rejection_sampling</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.sadd">jiffClient.protocols.bits.sadd</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.sdiv">jiffClient.protocols.bits.sdiv</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.seq">jiffClient.protocols.bits.seq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.sgt">jiffClient.protocols.bits.sgt</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.sgteq">jiffClient.protocols.bits.sgteq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.share">jiffClient.protocols.bits.share</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.slt">jiffClient.protocols.bits.slt</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.slteq">jiffClient.protocols.bits.slteq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.smult">jiffClient.protocols.bits.smult</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.sneq">jiffClient.protocols.bits.sneq</a></li><li data-type='method'><a href="bits.html#.jiffClient.protocols.bits.ssub">jiffClient.protocols.bits.ssub</a></li></ul></li><li><a href="handlers.html">handlers</a><ul class='methods'><li data-type='method'><a href="handlers.html#.jiffClient.handlers.build_initialization_message">jiffClient.handlers.build_initialization_message</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.connected">jiffClient.handlers.connected</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.error">jiffClient.handlers.error</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.initialized">jiffClient.handlers.initialized</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.receive_crypto_provider">jiffClient.handlers.receive_crypto_provider</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.receive_custom">jiffClient.handlers.receive_custom</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.receive_open">jiffClient.handlers.receive_open</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.receive_share">jiffClient.handlers.receive_share</a></li><li data-type='method'><a href="handlers.html#.jiffClient.handlers.store_public_keys">jiffClient.handlers.store_public_keys</a></li></ul></li><li><a href="helpers.html">helpers</a><ul class='methods'><li data-type='method'><a href="helpers.html#.jiffClient.helpers.array_equals">jiffClient.helpers.array_equals</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.bits_to_number">jiffClient.helpers.bits_to_number</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.bLog">jiffClient.helpers.bLog</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.ceil">jiffClient.helpers.ceil</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.extended_gcd">jiffClient.helpers.extended_gcd</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.floor">jiffClient.helpers.floor</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.get_party_number">jiffClient.helpers.get_party_number</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.is_prime">jiffClient.helpers.is_prime</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.mod">jiffClient.helpers.mod</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.number_to_bits">jiffClient.helpers.number_to_bits</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.pow_mod">jiffClient.helpers.pow_mod</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.random">jiffClient.helpers.random</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.sort_ids">jiffClient.helpers.sort_ids</a></li><li data-type='method'><a href="helpers.html#.jiffClient.helpers.Zp_equals">jiffClient.helpers.Zp_equals</a></li></ul></li><li><a href="hooks.html">hooks</a><ul class='methods'><li data-type='method'><a href="hooks.html#.computeShares">computeShares</a></li><li data-type='method'><a href="hooks.html#.execute_array_hooks">execute_array_hooks</a></li></ul></li><li><a href="protocols.html">protocols</a><ul class='methods'><li data-type='method'><a href="protocols.html#.jiffClient.protocols.generate_beaver_bgw">jiffClient.protocols.generate_beaver_bgw</a></li><li data-type='method'><a href="protocols.html#.jiffClient.protocols.generate_random_and_quotient">jiffClient.protocols.generate_random_and_quotient</a></li><li data-type='method'><a href="protocols.html#.jiffClient.protocols.generate_random_bit_bgw">jiffClient.protocols.generate_random_bit_bgw</a></li><li data-type='method'><a href="protocols.html#.jiffClient.protocols.generate_random_bit_smult">jiffClient.protocols.generate_random_bit_smult</a></li><li data-type='method'><a href="protocols.html#.jiffClient.protocols.generate_random_bits">jiffClient.protocols.generate_random_bits</a></li><li data-type='method'><a href="protocols.html#.jiffClient.protocols.generate_random_number">jiffClient.protocols.generate_random_number</a></li><li data-type='method'><a href="protocols.html#.jiffClient.protocols.generate_zero">jiffClient.protocols.generate_zero</a></li><li data-type='method'><a href="protocols.html#.jiffClient.protocols.rejection_sampling">jiffClient.protocols.rejection_sampling</a></li></ul></li><li><a href="utils.html">utils</a><ul class='methods'><li data-type='method'><a href="utils.html#.jiffClient.utils.bit_combinator">jiffClient.utils.bit_combinator</a></li><li data-type='method'><a href="utils.html#.jiffClient.utils.many_secret_shares">jiffClient.utils.many_secret_shares</a></li><li data-type='method'><a href="utils.html#.jiffClient.utils.resolve_many_secrets">jiffClient.utils.resolve_many_secrets</a></li></ul></li></ul>
</nav>

<div id="main">
    
    <h1 class="page-title">JIFFClient</h1>
    

    




<section>

<header>
    
        <h2>
            <span class="ancestors"><a href="module-jiff-client.html">jiff-client</a>~</span>
        
        JIFFClient
        </h2>
        
    
</header>

<article>
    
        <div class="container-overview">
        
            

    

    <h4 class="name" id="JIFFClient"><span class="type-signature"></span>new JIFFClient<span class="signature">(hostname<span class="signature-attributes">non-null</span>, computation_id<span class="signature-attributes">non-null</span>, options<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line65">line 65</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Creates a new jiff client instance.</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>var JIFFClient = require('jiffClient'); // only for node.js
&lt;script src="jiff-client.js">&lt;/script> // for the browser
// build a jiff instance which will connect to a server running on the local machine
var instance = new JIFFClient('http://localhost:8080', 'computation-1', {party_count: 2});</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>hostname</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>server hostname/ip and port.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>computation_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the id of the computation of this instance.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>options</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                
                    &lt;nullable><br>
                

                
                </td>
            

            
                <td class="default">
                
                    <code>{}</code>
                
                </td>
            

            <td class="description last"><p>javascript object with additional options.
all parameters are optional, However, private and public key must either be both provided or neither of them provided.</p>
 <pre>
 {
   "party_id": number,
   "party_count": number,
   "secret_key": Uint8Array to be used with libsodium-wrappers (check Library Specs),
   "public_key": Uint8Array to be used with libsodium-wrappers (check Library Specs),
   "public_keys": { 1: "Uint8Array PublicKey", 2: "Uint8Array PublicKey", ... },
   "Zp": default mod to use (prime number),
   "autoConnect": true/false,
   "hooks": { 'check out <a href="hooks.html">hooks documentation</a>' },
   "listeners" : A map from custom tags to listeners (of type function(sender_id, message_string)) that handle custom messages with that tag.
   "onConnect": function(jiff_instance),
   "onError": function(label, error): called when errors occured in client code or during handling requests from this client at the server side
                                      label is a string indicating where the error occured, and error is a string or an exception object.
   "safemod": boolean (whether or not to check if provided Zp is prime, may be slow for big primes, defaults to false),
   "crypto_provider": a boolean that flags whether to get beaver triplets and other preprocessing entities from the server (defaults to false),
   "socketOptions": an object, passed directly to socket.io constructor,
   "sodium": boolean, if false messages between clients will not be encrypted (useful for debugging),
   "maxInitializationRetries": how many consecutive times to retry to initialize with the server if initialization fails, defaults to 2,
   "preprocessingBatchSize": how many base level preprocessing tasks to execute in parallel.
 }
 </pre></td>
        </tr>

    
    </tbody>
</table>



















        
        </div>
    

    

    

    
        <h3 class="subsection-title">Classes</h3>

        <dl>
            <dt><a href="module-jiff-client-JIFFClient_SecretShare.html">SecretShare</a></dt>
            <dd></dd>
        </dl>
    
    
    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id="__initialized"><span class="type-signature">(non-null) </span>__initialized<span class="type-signature"> :boolean</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line133">line 133</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#isInitialized">isInitialized</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Private. Do not use directly externally; use isInitialized() instead.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">boolean</span>


        </li>
    </ul>






        
            
<h4 class="name" id="__ready"><span class="type-signature">(non-null) </span>__ready<span class="type-signature"> :boolean</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line126">line 126</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#isReady">isReady</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Private. Do not use directly externally; use isReady() instead.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">boolean</span>


        </li>
    </ul>






        
            
<h4 class="name" id="barriers"><span class="type-signature">(non-null) </span>barriers<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line258">line 258</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Stores all promises created within some barrier.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="computation_id"><span class="type-signature">(non-null) </span>computation_id<span class="type-signature"> :string</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line119">line 119</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Stores the computation id.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">string</span>


        </li>
    </ul>






        
            
<h4 class="name" id="counters"><span class="type-signature">(non-null) </span>counters<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line393">line 393</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Store sharing and shares counter which keeps track of the count of
sharing operations (share and open) and the total number of shares
respectively (used to get a unique id for each share operation and
share object).</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="crypto_provider"><span class="type-signature">(non-null) </span>crypto_provider<span class="type-signature"> :boolean</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line228">line 228</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Flags whether to use the server as a fallback for objects that were not pre-processed properly</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">boolean</span>


        </li>
    </ul>






        
            
<h4 class="name" id="currentPreprocessingTasks"><span class="type-signature">(non-null) </span>currentPreprocessingTasks<span class="type-signature"> :linkedlist</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line360">line 360</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Stores currently executing preprocessing tasks.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">linkedlist</span>


        </li>
    </ul>






        
            
<h4 class="name" id="custom_messages_mailbox"><span class="type-signature">(non-null) </span>custom_messages_mailbox<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line252">line 252</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Stores custom messages that are received before their listeners are set. Messages are stored in order.
{ 'tag' =&gt; [ { &quot;sender_id&quot;: &lt;sender_id&gt;, &quot;message&quot;: <message> }, ... ] }</p>
<p>Once a listener has been set, the corresponding messages are sent to it in order.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="default_preprocessing_protocols"><span class="type-signature">(non-null) </span>default_preprocessing_protocols<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line354">line 354</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Store the default preprocessing protocols for each type of preprocessing value</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="deferreds"><span class="type-signature">(non-null) </span>deferreds<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line384">line 384</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>A map from some message operation id to a deferred resolved when that message is received.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="extensions"><span class="type-signature"></span>extensions<span class="type-signature"> :Array.&lt;string></span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line286">line 286</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>An array containing the names (jiff-client-[name].js) of the extensions that are
applied to this instance.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Array.&lt;string></span>


        </li>
    </ul>






        
            
<h4 class="name" id="handlers"><span class="type-signature">(non-null) </span>handlers<span class="type-signature"> :<a href="handlers.html">handlers</a></span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line415">line 415</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Contains handlers for communication events</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="handlers.html">handlers</a></span>


        </li>
    </ul>






        
            
<h4 class="name" id="helpers"><span class="type-signature">(non-null) </span>helpers<span class="type-signature"> :<a href="helpers.html">helpers</a></span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line159">line 159</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Helper functions [DO NOT MODIFY UNLESS YOU KNOW WHAT YOU ARE DOING].</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="helpers.html">helpers</a></span>


        </li>
    </ul>






        
            
<h4 class="name" id="hooks"><span class="type-signature">(non-null) </span>hooks<span class="type-signature"> :<a href="hooks.html">hooks</a></span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line409">line 409</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>The hooks for this instance.
Checkout the <a href="hooks.html">hooks documentation</a></p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="hooks.html">hooks</a></span>


        </li>
    </ul>






        
            
<h4 class="name" id="hostname"><span class="type-signature">(non-null) </span>hostname<span class="type-signature"> :string</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line110">line 110</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>The server hostname, ends with a slash, includes port and protocol (http/https).</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">string</span>


        </li>
    </ul>






        
            
<h4 class="name" id="id"><span class="type-signature"></span>id<span class="type-signature"> :number</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line186">line 186</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>The id of this party.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">number</span>


        </li>
    </ul>






        
            
<h4 class="name" id="initialization_counter"><span class="type-signature">(non-null) </span>initialization_counter<span class="type-signature"> :number</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line272">line 272</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Counts how many times JIFF attempted to initialize with the server
without success consecutively.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">number</span>


        </li>
    </ul>






        
            
<h4 class="name" id="keymap"><span class="type-signature">(non-null) </span>keymap<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line208">line 208</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption.html">https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption.html</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>A map from party id to public key. Where key is the party id (number), and
value is the public key, which by default follows libsodium's specs (Uint8Array).</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="listeners"><span class="type-signature">(non-null) </span>listeners<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line243">line 243</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>A map from tags to listeners (functions that take a sender_id and a string message).</p>
<p>Stores listeners that are attached to this JIFF instance, listeners listen to custom messages sent by other parties.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="logs"><span class="type-signature">(non-null) </span>logs<span class="type-signature"> :Array</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line372">line 372</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Used for logging/debugging</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Array</span>


        </li>
    </ul>






        
            
<h4 class="name" id="messagesWaitingKeys"><span class="type-signature"></span>messagesWaitingKeys<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line235">line 235</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Stores messages that are received with a signature prior to acquiring the public keys of the sender.
{ 'party_id': [ { 'label': 'share/open/custom', <other attributes of the message> } ] }</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="op_id_seed"><span class="type-signature"></span>op_id_seed<span class="type-signature"> :string</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line402">line 402</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#seed_ids">seed_ids</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>A prefix attached to all op_ids, can be changed using <a href="module-jiff-client-JIFFClient.html#seed_ids">seed_ids</a>
to guarantee uniqueness of auto generate ids in a user-side callback
or event handler.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">string</span>


        </li>
    </ul>






        
            
<h4 class="name" id="options"><span class="type-signature">(non-null) </span>options<span class="type-signature"> :Object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line166">line 166</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Shallow copy of the options passed to the constructor.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="party_count"><span class="type-signature"></span>party_count<span class="type-signature"> :number</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line192">line 192</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Total party count in the computation, parties will take ids between 1 to party_count (inclusive).</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">number</span>


        </li>
    </ul>






        
            
<h4 class="name" id="preprocessing_function_map"><span class="type-signature">(non-null) </span>preprocessing_function_map<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line348">line 348</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>maps all primitive operations to the other operations they are dependent on, until leaves are primitives for which preprocessing protocols are defined,
this map is traversed during preprocessing to guide preprocessing of high level operations. Extensions should modify this map to reflect
any required changes to preprocessing of modified primitives</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="preprocessing_table"><span class="type-signature">(non-null) </span>preprocessing_table<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line334">line 334</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Stores pre-computed values (beaver triples, random bits, etc) used to aid/speed up the main processes.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="preprocessingBatchSize"><span class="type-signature">(non-null) </span>preprocessingBatchSize<span class="type-signature"> :Number</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line340">line 340</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Sets batch size for base level preprocessing tasks</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>






        
            
<h4 class="name" id="preprocessingCallback"><span class="type-signature">(nullable) </span>preprocessingCallback<span class="type-signature"> :function</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line366">line 366</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Callback to execute when preprocessing is done!</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">function</span>


        </li>
    </ul>






        
            
<h4 class="name" id="protocols"><span class="type-signature">(non-null) </span>protocols<span class="type-signature"> :<a href="protocols.html">protocols</a></span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line321">line 321</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>A collection of useful protocols to be used during computation or preprocessing: extensions are encouraged to add useful
common protocols here, under a sub namespace corresponding to the extension name.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="protocols.html">protocols</a></span>


        </li>
    </ul>






        
            
<h4 class="name" id="public_key"><span class="type-signature">(nullable) </span>public_key<span class="type-signature"> :Uint8Array</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line222">line 222</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption.html">https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption.html</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>The public key of this party, by default this follows libsodium's specs.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Uint8Array</span>


        </li>
    </ul>






        
            
<h4 class="name" id="secret_key"><span class="type-signature">(nullable) </span>secret_key<span class="type-signature"> :Uint8Array</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line215">line 215</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption.html">https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption.html</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>The secret key of this party, by default this follows libsodium's specs.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Uint8Array</span>


        </li>
    </ul>






        
            
<h4 class="name" id="share_helpers"><span class="type-signature">(non-null) </span>share_helpers<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line293">line 293</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Internal helpers for operations inside/on a share. Modify existing helpers or add more in your extensions
to avoid having to re-write and duplicate the code for primitives.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="shares"><span class="type-signature">(non-null) </span>shares<span class="type-signature"> :object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line378">line 378</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>A map from open operation id to the corresponding shares received for that open operation</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="socket"><span class="type-signature">(non-null) </span>socket<span class="type-signature"> :<a href="GuardedSocket.html">GuardedSocket</a></span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line430">line 430</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Socket wrapper between this instance and the server, based on sockets.io</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="GuardedSocket.html">GuardedSocket</a></span>


        </li>
    </ul>






        
            
<h4 class="name" id="sodium_"><span class="type-signature">(nullable) </span>sodium_<span class="type-signature"> :sodium</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line200">line 200</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://www.npmjs.com/package/libsodium-wrappers">https://www.npmjs.com/package/libsodium-wrappers</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>sodium wrappers either imported via require (if in nodejs) or from the bundle (in the browser).
This will be false if options.sodium is false.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">sodium</span>


        </li>
    </ul>






        
            
<h4 class="name" id="utils"><span class="type-signature">(non-null) </span>utils<span class="type-signature"> :<a href="utils.html">utils</a></span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line278">line 278</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Utility functions</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="utils.html">utils</a></span>


        </li>
    </ul>






        
            
<h4 class="name" id="wait_callbacks"><span class="type-signature">(non-null) </span>wait_callbacks<span class="type-signature"> :Array</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line264">line 264</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Stores the parties and callbacks for every .wait_for() registered by the user.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Array</span>


        </li>
    </ul>






        
            
<h4 class="name" id="Zp"><span class="type-signature">(non-null) </span>Zp<span class="type-signature"> :number</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line180">line 180</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>The default Zp for this instance.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">number</span>


        </li>
    </ul>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="add_to_barriers"><span class="type-signature"></span>add_to_barriers<span class="signature">(promise)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_synchronization.js.html">client/api/synchronization.js</a>, <a href="client_api_synchronization.js.html#line22">line 22</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Adds given promise to all active barriers.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>promise</code></td>
            

            <td class="type">
            
                
<span class="param-type">promise</span>


            
            </td>

            

            

            <td class="description last"><p>the promise to add.</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="apply_extension"><span class="type-signature"></span>apply_extension<span class="signature">(ext, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_extensions.js.html">client/arch/extensions.js</a>, <a href="client_arch_extensions.js.html#line27">line 27</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#can_apply_extension">can_apply_extension</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Applies the given extension.
If the extension is safe (as per can_apply_extension), it will be applied successfully.
If the extension is not safe to be applied, an exception will be thrown with an appropriate error message.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>ext</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the namespace of the extension acquired when the extension is imported, should contain a make_jiff function.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>options</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>{}</code>
                
                </td>
            

            <td class="description last"><p>optional options to be passed to the extension.</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="can_apply_extension"><span class="type-signature"></span>can_apply_extension<span class="signature">(name)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_extensions.js.html">client/arch/extensions.js</a>, <a href="client_arch_extensions.js.html#line15">line 15</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Checks if a given extension can be safely applied to the instance</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the extension name (found in the filename at jiff-client[name].js)</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>true if the extension can be safely applied, otherwise returns an error message.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="connect"><span class="type-signature"></span>connect<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line445">line 445</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Connect to the server and starts listening.</p>
</div>




























        
            

    

    <h4 class="name" id="disconnect"><span class="type-signature"></span>disconnect<span class="signature">(safe<span class="signature-attributes">opt</span>, free<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_initialization.js.html">client/api/initialization.js</a>, <a href="client_api_initialization.js.html#line28">line 28</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Disconnects from the computation.
Allows the client program to exit.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>safe</code></td>
            

            <td class="type">
            
                
<span class="param-type">boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>false</code>
                
                </td>
            

            <td class="description last"><p>if true, jiff will disconnect safely (i.e. after ensuring all
outgoing pending messages were delivered).</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>free</code></td>
            

            <td class="type">
            
                
<span class="param-type">boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>false</code>
                
                </td>
            

            <td class="description last"><p>if set to true, it means this party's disconnection is final, and all resources
associated with this party must be freed.
If all parties in a computation are freed, then all resources associated with the
computation are freed, and any subsequent reconnection to the computation is as
if a the connection is for a fresh new computation.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>executed after the instance safely disconnects, if safe is set to false, this
parameter is ignored.</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="emit"><span class="type-signature"></span>emit<span class="signature">(tag, receivers<span class="signature-attributes">opt</span>, message, encrypt<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_custom.js.html">client/api/custom.js</a>, <a href="client_api_custom.js.html#line2">line 2</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Sends a custom message to a subset of parties</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>tag</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the tag to attach to the message</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>contains the party ids to receive the message, defaults to all parties</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>message</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the message to send</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>encrypt</code></td>
            

            <td class="type">
            
                
<span class="param-type">boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>true</code>
                
                </td>
            

            <td class="description last"><p>if true, messages will be encrypted</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="end_barrier"><span class="type-signature"></span>end_barrier<span class="signature">(barrier_id<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {promise}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_synchronization.js.html">client/api/synchronization.js</a>, <a href="client_api_synchronization.js.html#line39">line 39</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Executes the callback only after all promises / secret shares in the barrier were resolved.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>barrier_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>jiff.barriers.length - 1</code>
                
                </td>
            

            <td class="description last"><p>identifies the barrier, should be returned by start_barrier.
by default, barrier_id will refer to the last barrier.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a promise that resolves after the secret shares are resolved.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">promise</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="executePreprocessing"><span class="type-signature"></span>executePreprocessing<span class="signature">(callback<span class="signature-attributes">non-null</span>)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_preprocessing_api.js.html">client/preprocessing/api.js</a>, <a href="client_preprocessing_api.js.html#line150">line 150</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Ask JIFF to start executing preprocessing for tasks previously added by <a href="module-jiff-client-JIFFClient.html#preprocessing">preprocessing</a>.</p>
<p>Calls the provided callback when the preprocessing tasks are all done.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            

            

            <td class="description last"><p>the callback to execute when preprocessing is finished.
<a href="module-jiff-client-JIFFClient.html#preprocessing">preprocessing</a></p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="extension_applied"><span class="type-signature"></span>extension_applied<span class="signature">(name, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_extensions.js.html">client/arch/extensions.js</a>, <a href="client_arch_extensions.js.html#line56">line 56</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Called when an extension is applied successfully. Override to change behavior of your extension based on future extensions.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the name of the applied extension.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>options</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>{}</code>
                
                </td>
            

            <td class="description last"><p>the options passed by the user to the newly applied extension.</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="free"><span class="type-signature"></span>free<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_initialization.js.html">client/api/initialization.js</a>, <a href="client_api_initialization.js.html#line55">line 55</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#disconnect">disconnect</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Emits event to free up all the resources allocated for this party on the server.
It is best not to call this function directly, as it can break things if resources still need to be used.
Instead, use jiff.disconnect(safe, free, callback) to free after safely disconnecting.</p>
</div>




























        
            

    

    <h4 class="name" id="from_crypto_provider"><span class="type-signature"></span>from_crypto_provider<span class="signature">(label, receivers_list<span class="signature-attributes">opt</span>, threshold<span class="signature-attributes">opt</span>, Zp<span class="signature-attributes">opt</span>, op_id<span class="signature-attributes">opt</span>, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {promise}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_crypto_provider.js.html">client/api/crypto_provider.js</a>, <a href="client_api_crypto_provider.js.html#line2">line 2</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Requests secret(s) from the server (crypto provider) of type matching the given label.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>label</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the type of secret(s) being requested from crypto_provider (e.g. triplet, quotient, numbers, etc)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>array of party ids that want to receive the secret(s), by default, this includes all parties.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>threshold</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>receivers_list.length</code>
                
                </td>
            

            <td class="description last"><p>the min number of parties needed to reconstruct the secret(s).</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>Zp</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>jiff_instance.Zp</code>
                
                </td>
            

            <td class="description last"><p>the mod, defaults to the Zp of the instance.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_Gen()</code>
                
                </td>
            

            <td class="description last"><p>an id which is used to identify the secret requested, so that every party
gets a share from the same secret for every matching instruction. An automatic id
is generated by increasing a local counter per label, default ids suffice when all
parties execute all instructions in the same order.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>params</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>{}</code>
                
                </td>
            

            <td class="description last"><p>any additional parameters specific to the label, these are defined by the label handler at the server side.
some of these parameters may be optional, while others may be required.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a promise to the secret(s) provided by the server/crypto provider, the promise returns an object with the given format:
{ values: <any values returned by the server side>, shares: <array of secret share objects matching shares returned by server by index>}</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">promise</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="gen_op_id"><span class="type-signature"></span>gen_op_id<span class="signature">(op, holders)</span><span class="type-signature"> &rarr; {string}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_counters.js.html">client/arch/counters.js</a>, <a href="client_arch_counters.js.html#line46">line 46</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Generate a unique operation id for a new operation object.
The returned op_id will be unique with respect to other operations, and identifies the same
operation across all parties, as long as all parties are executing instructions in the same order.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>op</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the type/name of operation performed.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>holders</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>an array containing the ids of all the parties carrying out the operation.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>the op_id for the operation.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="gen_op_id2"><span class="type-signature"></span>gen_op_id2<span class="signature">(op, receivers, senders)</span><span class="type-signature"> &rarr; {string}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_counters.js.html">client/arch/counters.js</a>, <a href="client_arch_counters.js.html#line65">line 65</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Generate a unique operation id for a new operation object given two distinct executing parties lists.
For example, when sharing, this is given two potentially different lists of senders and receivers.
The returned op_id will be unique with respect to other operations, and identifies the same
operation across all parties, as long as all parties are executing instructions in the same order.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>op</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the type/name of operation performed.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>an array containing the ids of all the parties carrying out the receiving portion of the operation.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>senders</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>an array containing the ids of all the parties carrying out the sending portion of the operation.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>the op_id for the operation.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="gen_op_id2_preprocessing"><span class="type-signature"></span>gen_op_id2_preprocessing<span class="signature">(op, receivers, senders)</span><span class="type-signature"> &rarr; {string}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_counters.js.html">client/arch/counters.js</a>, <a href="client_arch_counters.js.html#line105">line 105</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Generate a unique operation id for a new operation object given two distinct executing parties lists (for preprocessing).
For example, when sharing, this is given two potentially different lists of senders and receivers.
The returned op_id will be unique with respect to other operations, and identifies the same
operation across all parties, as long as all parties are executing instructions in the same order.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>op</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the type/name of operation performed.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>an array containing the ids of all the parties carrying out the receiving portion of the operation.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>senders</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>an array containing the ids of all the parties carrying out the sending portion of the operation.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>the op_id for the operation.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="gen_op_id_preprocessing"><span class="type-signature"></span>gen_op_id_preprocessing<span class="signature">(op, holders)</span><span class="type-signature"> &rarr; {string}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_counters.js.html">client/arch/counters.js</a>, <a href="client_arch_counters.js.html#line86">line 86</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Generate a unique operation id for a new operation object (for preprocessing)
The returned op_id will be unique with respect to other operations, and identifies the same
operation across all parties, as long as all parties are executing instructions in the same order.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>op</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the type/name of operation performed.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>holders</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>an array containing the ids of all the parties carrying out the operation.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>the op_id for the operation.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="get_preprocessing"><span class="type-signature"></span>get_preprocessing<span class="signature">(op_id)</span><span class="type-signature"> &rarr; {object}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_preprocessing_api.js.html">client/preprocessing/api.js</a>, <a href="client_preprocessing_api.js.html#line26">line 26</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Get a preprocessed share/value by associated op_id. If value does not exist
Fallback to some user specified way for creating it</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the op_id associated with the preprocessed value/share</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>the preprocessed share(s)</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">object</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="has_extension"><span class="type-signature"></span>has_extension<span class="signature">(name)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_extensions.js.html">client/arch/extensions.js</a>, <a href="client_arch_extensions.js.html#line3">line 3</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Checks if the given extension is applied.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the extension name (found in the extension filename as jiff-client-[name].js).</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>true if the extension was applied, false otherwise.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="has_preprocessing"><span class="type-signature"></span>has_preprocessing<span class="signature">(op)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_preprocessing_api.js.html">client/preprocessing/api.js</a>, <a href="client_preprocessing_api.js.html#line8">line 8</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Checks if the given operation uses preprocessed values</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>op</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>name of the operation to check</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>true if the op uses preprocessing, false otherwise</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="internal_open"><span class="type-signature"></span>internal_open<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line98">line 98</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#open">open</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Same as open, but used by internal JIFF primitives/protocols, do not override this!</p>
</div>




























        
            

    

    <h4 class="name" id="internal_share"><span class="type-signature"></span>internal_share<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line51">line 51</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#share">share</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Same as share, but used by internal JIFF primitives/protocols, do not override this!</p>
</div>




























        
            

    

    <h4 class="name" id="isInitialized"><span class="type-signature"></span>isInitialized<span class="signature">()</span><span class="type-signature"> &rarr; (non-null) {boolean}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line151">line 151</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Returns whether this instance initialized successfully with the server.
Note that this can be true even when isReady() returns false, in case where some other parties have not
initialized yet!</p>
</div>

























<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="isReady"><span class="type-signature"></span>isReady<span class="signature">()</span><span class="type-signature"> &rarr; (non-null) {boolean}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="jiff-client.js.html">jiff-client.js</a>, <a href="jiff-client.js.html#line141">line 141</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Returns whether this instance is capable of starting the computation.
In other words, the public keys for all parties and servers are known,
and this party successfully initialized with the server.</p>
</div>

























<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="listen"><span class="type-signature"></span>listen<span class="signature">(tag, handler)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_custom.js.html">client/api/custom.js</a>, <a href="client_api_custom.js.html#line47">line 47</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Registers the given function as a listener for messages with the given tag.
Removes any previously set listener for this tag.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>tag</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the tag to listen for.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>handler</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            

            

            <td class="description last"><p>the function that handles the received message: takes the sender id and the message as parameters.</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="open"><span class="type-signature"></span>open<span class="signature">(share, parties<span class="signature-attributes">opt</span>, op_id<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; (nullable) {promise}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line80">line 80</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Open a secret share to reconstruct secret.</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>var shares = jiff_instance.share(input);
//multiply the inputs of party 1 and 2 together
var result = shares[1].mult(shares[2]);
// reveal the result of the multiplication to all parties
return jiff_instance.open(result);</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>share</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="module-jiff-client-JIFFClient_SecretShare.html">module:jiff-client~JIFFClient#SecretShare</a></span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>this party's share of the secret to reconstruct.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>parties</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>an array with party ids (1 to n) of receiving parties.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_gen()</code>
                
                </td>
            

            <td class="description last"><p>the operation id to be used to tag outgoing messages.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a (JQuery) promise to the open value of the secret, null if the party is not specified in the parties array as a receiver.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">promise</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="open_array"><span class="type-signature"></span>open_array<span class="signature">(shares, parties<span class="signature-attributes">opt</span>, op_id<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; (nullable) {promise}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line178">line 178</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Opens an array of secret shares.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>shares</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array.&lt;<a href="module-jiff-client-JIFFClient_SecretShare.html">module:jiff-client~JIFFClient#SecretShare</a>></span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>an array containing this party's shares of the secrets to reconstruct</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>parties</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>an array with party ids (1 to n) of receiving parties</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_gen()</code>
                
                </td>
            

            <td class="description last"><p>same as jiff_instance.open</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a (JQuery) promise to ALL the open values of the secret, the promise will yield
an array of values matching the corresponding given secret share by index. If the calling party
is not specified in parties, then null is returned</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">promise</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="preprocessing"><span class="type-signature"></span>preprocessing<span class="signature">(dependent_op, count<span class="signature-attributes">opt</span>, protocols<span class="signature-attributes">opt</span>, threshold<span class="signature-attributes">opt</span>, receivers_list<span class="signature-attributes">opt</span>, compute_list<span class="signature-attributes">opt</span>, Zp<span class="signature-attributes">opt</span>, id_list<span class="signature-attributes">opt</span>, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {promise}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_preprocessing_api.js.html">client/preprocessing/api.js</a>, <a href="client_preprocessing_api.js.html#line61">line 61</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="module-jiff-client-JIFFClient.html#executePreprocessing">executePreprocessing</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Generate values used for JIFF operations in advance of the computation.</p>
<p>Calling this function does not begin preprocessing, it just creates a preprocessing task. After you created
your desired tasks, you can ask JIFF to execute them via <a href="module-jiff-client-JIFFClient.html#executePreprocessing">executePreprocessing</a>.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>dependent_op</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>name of the operation that will later use the pre_processed values</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>count</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>1</code>
                
                </td>
            

            <td class="description last"><p>number of times the protocol should be performed, number of values that will be generated</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>protocols</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>defaults</code>
                
                </td>
            

            <td class="description last"><p>a mapping from base preprocessing elements ('beaver', 'bits', 'sampling') to functions that can pre-process them
the function must implement the same interface as the JIFF provided protocols (e.g. jiffClient.protocols.generate_beaver_bgw),
missing mappings indicate that JIFF must use the default protocols</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>threshold</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>receivers_list.length</code>
                
                </td>
            

            <td class="description last"><p>the threshold of the preprocessed shares</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>the parties that will receive the preprocsssed shares</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>compute_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>the parties that will compute the preprocsssed shares</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>Zp</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>jiffClient.Zp</code>
                
                </td>
            

            <td class="description last"><p>the Zp of the preprocessed shares</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>id_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_gen()</code>
                
                </td>
            

            <td class="description last"><p>array of ids to be used sequentially to identify the pre_processed values</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>params</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>{}</code>
                
                </td>
            

            <td class="description last"><p>any additional protocol-specific parameters</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a promise that is resolved when preprocessing is completed, null if this is called by a party that is neither a compute nor receiver party</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">promise</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="preprocessingDaemon"><span class="type-signature"></span>preprocessingDaemon<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_preprocessing_daemon.js.html">client/preprocessing/daemon.js</a>, <a href="client_preprocessing_daemon.js.html#line188">line 188</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Preprocessing Daemon that executes all currently scheduled preprocessing tasks (entries in jiffClient.currentPreprocessingTasks array) in order.</p>
</div>




























        
            

    

    <h4 class="name" id="receive_open"><span class="type-signature"></span>receive_open<span class="signature">(senders, receivers<span class="signature-attributes">opt</span>, threshold<span class="signature-attributes">opt</span>, Zp<span class="signature-attributes">opt</span>, op_id<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; (non-null) {promise}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line107">line 107</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Receive shares from the specified parties and reconstruct their secret.
Use this function in a party that will receive some answer/value but does not have a share of it.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>senders</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>an array with party ids (1 to n) specifying the parties sending the shares, this must be provided!</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>an array with party ids (1 to n) specifying the parties receiving the result</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>threshold</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>senders.length</code>
                
                </td>
            

            <td class="description last"><p>the min number of parties needed to reconstruct the secret, defaults to all the senders</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>Zp</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>jiff_instance.Zp</code>
                
                </td>
            

            <td class="description last"><p>the mod (if null then the default Zp for the instance is used)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_Gen()</code>
                
                </td>
            

            <td class="description last"><p>same as jiff-instance.open</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a (JQuery) promise to the open value of the secret.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">promise</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="remove_listener"><span class="type-signature"></span>remove_listener<span class="signature">(tag)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_custom.js.html">client/api/custom.js</a>, <a href="client_api_custom.js.html#line73">line 73</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Removes the custom message listener attached to the given tag</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>tag</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the tag of the listener to remove</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="reshare"><span class="type-signature"></span>reshare<span class="signature">(share<span class="signature-attributes">opt</span>, threshold<span class="signature-attributes">opt</span>, receivers_list<span class="signature-attributes">opt</span>, senders_list<span class="signature-attributes">opt</span>, Zp<span class="signature-attributes">opt</span>, op_id<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="module-jiff-client-JIFFClient_SecretShare.html">module:jiff-client~JIFFClient#SecretShare</a>}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line60">line 60</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>re-share an existing share (value) under a new threshold or to a new set of parties or both.
Do not use this to refresh a share (use <a href="module-jiff-client-JIFFClient_SecretShare.html#refresh">refresh</a> instead)</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>share</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="module-jiff-client-JIFFClient_SecretShare.html">module:jiff-client~JIFFClient#SecretShare</a></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>null</code>
                
                </td>
            

            <td class="description last"><p>the share you would like to reshare (null if you are a receiver but not a sender)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>threshold</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>receivers_list.length</code>
                
                </td>
            

            <td class="description last"><p>the new threshold, defaults to the length of receivers_list param</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>array of party ids to receive from, by default, this includes all parties</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>senders_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>array of party ids that posses the share and will reshare it with the receivers, by default, this includes all parties</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>Zp</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>jiff.Zp</code>
                
                </td>
            

            <td class="description last"><p>the Zp of the existing share</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_gen()</code>
                
                </td>
            

            <td class="description last"><p>the operation id which is used to identify this multiplication (and internally, the corresponding beaver triplet).
This id must be unique, and must be passed by all parties to the same instruction.
this ensures that every party gets a share from the same triplet for every matching instruction. An automatic id
is generated by increasing a local counter, default ids suffice when all parties execute the
instructions in the same order</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>this party's share of the result under the new threshold, or null if this party is not a receiver</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type"><a href="module-jiff-client-JIFFClient_SecretShare.html">module:jiff-client~JIFFClient#SecretShare</a></span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="seed_ids"><span class="type-signature"></span>seed_ids<span class="signature">(base_op_id)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_arch_counters.js.html">client/arch/counters.js</a>, <a href="client_arch_counters.js.html#line25">line 25</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Shorthand for generating unique operation ids.
All primitives called after this seed will use their usual default ids prefixed by the seed.
Helpful when we have nested callbacks/functions (e.g. share_arrays) that may be executed in arbitrary order,
using this function as a the first call inside such callbacks with an appropriate deterministic unique base_op_id
ensures that regardless of the order of execution, operations in the same callback are matched correctly across
all parties.
Check out demos/graph-pip/mpc.js for an example on using this.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>base_op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"><p>the base seed to use as a prefix for all future op_ids.</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="share"><span class="type-signature"></span>share<span class="signature">(secret, threshold<span class="signature-attributes">opt</span>, receivers_list<span class="signature-attributes">opt</span>, senders_list<span class="signature-attributes">opt</span>, Zp<span class="signature-attributes">opt</span>, share_id<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {object}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line7">line 7</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Share a secret input</p>
<p>Can be overriden by extensions to customize behavior</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>// share an input value with all parties, and receive all other parties' inputs
var shares = jiffClient.share(input);
// my party id is '1', so the first share is mine (technically my share of my input value)
var my_share = shares[1];
// my share of party 2's input
var p2_share = shares[2];</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>secret</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the number to share (this party's input)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>threshold</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>receivers_list.length</code>
                
                </td>
            

            <td class="description last"><p>the minimum number of parties needed to reconstruct the secret, defaults to all the receivers</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>array of party ids to share with, by default, this includes all parties</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>senders_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>array of party ids to receive from, by default, this includes all parties</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>Zp</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>jiff_instance.Zp</code>
                
                </td>
            

            <td class="description last"><p>the mod (if null then the default Zp for the instance is used)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>share_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_gen()</code>
                
                </td>
            

            <td class="description last"><p>the tag used to tag the messages sent by this share operation, this tag is used
so that parties distinguish messages belonging to this share operation from other
share operations between the same parties (when the order of execution is not
deterministic). An automatic id is generated by increasing a local counter, default
ids suffice when all parties execute all sharing operations with the same senders
and receivers in the same order</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a map (of size equal to the number of sending parties)
where the key is the party id (between 1 and n), or 's1' if 's1' is specified in the senders_list,
and the value is the share object that wraps the value received from that party (the internal value maybe
deferred).</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">object</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="share_array"><span class="type-signature"></span>share_array<span class="signature">(array, lengths<span class="signature-attributes">opt</span>, threshold<span class="signature-attributes">opt</span>, receivers_list<span class="signature-attributes">opt</span>, senders_list<span class="signature-attributes">opt</span>, Zp<span class="signature-attributes">opt</span>, share_id<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; (nullable) {promise}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_sharing.js.html">client/api/sharing.js</a>, <a href="client_api_sharing.js.html#line145">line 145</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Share an array of values. Each sender may have an array of different length. This is handled by the lengths parameter.
This function will reveal the lengths of the shared array.</p>
<p>If parties would like to keep the lengths of their arrays secret, they should agree on some public &quot;max&quot; length apriori (either under MPC
or as part of the logistics of the computation), all their arrays should be padded to that length by using appropriate default/identity
values</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>array</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the array to be shared.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>lengths</code></td>
            

            <td class="type">
            
                
<span class="param-type">null</span>
|

<span class="param-type">number</span>
|

<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>the lengths of the arrays to be shared, has the following options: <br>
1. null: lengths are unknown, each sender will publicly reveal the lengths of its own array. <br>
2. number: all arrays are of this length <br>
3. object: { &lt;sender_party_id&gt;: length }: must specify the length of the array for each sender. <br></p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>threshold</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>receivers_list.length</code>
                
                </td>
            

            <td class="description last"><p>the min number of parties needed to reconstruct the secret, defaults to all the receivers.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>receivers_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>array of party ids to share with, by default, this includes all parties.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>senders_list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>all_parties</code>
                
                </td>
            

            <td class="description last"><p>array of party ids to receive from, by default, this includes all parties.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>Zp</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>jiff_instance.Zp</code>
                
                </td>
            

            <td class="description last"><p>the mod (if null then the default Zp for the instance is used).</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>share_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>auto_gen()</code>
                
                </td>
            

            <td class="description last"><p>the base tag used to tag the messages sent by this share operation, every element of the array
will get a unique id based on the concatenation of base_share_id and the index of the element.
This tag is used so that parties distinguish messages belonging to this share operation from
other share operations between the same parties (when the order of execution is not
deterministic). An automatic id is generated by increasing a local counter, default
ids suffice when all parties execute all sharing operations with the same senders
and receivers in the same order.</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>if the calling party is a receiver then a promise to the shared arrays is returned, the promise will provide an object
formatted as follows: { &lt;party_id&gt;: [ &lt;1st_share&gt;, &lt;2nd_share&gt;, ..., &lt;(lengths[party_id])th_share&gt; ] }
where the party_ids are those of the senders.
if the calling party is not a receiver, then null is returned.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">promise</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="start_barrier"><span class="type-signature"></span>start_barrier<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_api_synchronization.js.html">client/api/synchronization.js</a>, <a href="client_api_synchronization.js.html#line6">line 6</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Starts a new barrier, all promises and secret shares created between this call and the corresponding start_barrier
call will be part of this barrier. start_barrier may be called before previous barriers are resolved, in which
case promises / secret shares created will be part of the new barrier as well as any previous barriers.</p>
</div>

























<h5>Returns:</h5>

        
<div class="param-desc">
    <p>a barrier id that identifies this barrier.</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">number</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="store_preprocessing"><span class="type-signature"></span>store_preprocessing<span class="signature">(op_id, share)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="client_preprocessing_api.js.html">client/preprocessing/api.js</a>, <a href="client_preprocessing_api.js.html#line46">line 46</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Store a pair of op_id and associated pre-processed value/share
The value/share can be accessed later during the computation through jiffClient.get_preprocessing(op_id)</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>op_id</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>the op_id associated with the preprocessed value/share</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>share</code></td>
            

            <td class="type">
            
                
<span class="param-type">SecretShare</span>


            
            </td>

            

            

            <td class="description last"><p>the share/value to store</p></td>
        </tr>

    
    </tbody>
</table>



















        
    

    

    
</article>

</section>




    
    
</div>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jun 11 2020 12:17:15 GMT-0400 (Eastern Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>

<script src="scripts/search.js" defer></script>



</body>
</html>
